//
//  DestImpressionsSecondTableViewCell.m
//  TravelEveryDay
//
//  Created by dlios on 15/10/21.
//  Copyright © 2015年 com.lanou3g. All rights reserved.
//

#import "DestImpressionsSecondTableViewCell.h"
#import "BaseHeader.h"
@implementation DestImpressionsSecondTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(10 *WIDTH, 0, SCREEN_WIDTH-10 , 0.5)];
        lineView.backgroundColor = [UIColor lightGrayColor];

        _avatar_sImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT, 36 * HEIGHT  , 36 * HEIGHT)];
        _avatar_sImageView.layer.cornerRadius = 18 *HEIGHT;
        _avatar_sImageView.userInteractionEnabled  = YES;
        _ImageViewButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _ImageViewButton.frame = CGRectMake(0, 0, 200*HEIGHT , 41 *HEIGHT);
        _avatar_sImageView.layer.masksToBounds = YES;
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(36 *HEIGHT +10 * WIDTH, 5 * HEIGHT, 200 * WIDTH, 11 *HEIGHT)];
        _nameLabel.font =[UIFont systemFontOfSize:14.0];
        _trip_textLabel = [[UILabel alloc]initWithFrame:CGRectZero];
        _trip_textLabel.numberOfLines = 0;
        _trip_textLabel.font = [UIFont systemFontOfSize:13.0f];
        [self.contentView addSubview:lineView];
        [self.contentView addSubview:_avatar_sImageView];
        [self.contentView addSubview:_nameLabel];
        [self.contentView addSubview:_ImageViewButton];
        [self.contentView addSubview:_trip_textLabel];
    }
    return self;
}

- (void)setDataModel:(DestImpressionSecondModel *)dataModel {
    CGFloat hegigh = [StringWithHeight heightWithText:[NSString stringWithFormat:@"^_^%@",dataModel.content] width:355 * WIDTH font:[UIFont systemFontOfSize:13.0f]];
    _trip_textLabel.frame = CGRectMake(10 *WIDTH, 46 *HEIGHT, 355* WIDTH, hegigh );

    _trip_textLabel.text =[NSString stringWithFormat:@"^_^%@",dataModel.content];
    _nameLabel.text = [dataModel.user objectForKey:@"name"];
    NSString *imageStr = [dataModel.user objectForKey:@"avatar_l"];
    NSURL *iamgeUrl = [NSURL URLWithString:imageStr];
    [_avatar_sImageView sd_setImageWithURL:iamgeUrl placeholderImage:PLACEHOLDERIMAGE];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
